package com.zh.note.leetcode.string;

import java.util.Map;

/**
 * 344. 反转字符串
 */
public class LC_344_reverseString {

    /**
     * 双指针法
     * 首尾指针
     */
    public void reverseString(char[] s) {

        for (int i = 0, j = s.length - 1; i < s.length / 2; i++, j--) {
            swap(s, i, j);
        }

    }

    private static void swap(char[] s, int i, int j) {
        char temp = s[i];
        s[i] = s[j];
        s[j] = temp;
    }


}
